package com.pay.ioopos.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;

import com.pay.ioopos.BindState;
import com.pay.ioopos.KeyInfo;
import com.pay.ioopos.KeyInfoListener;
import com.pay.ioopos.R;


public class RefundPwdFragment extends AbstractNetworkFragment implements KeyInfoListener, BindState {
    private PwdInputFragment pwdInput = new PwdInputFragment();

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_password, container, false);
    }

    @Override
    protected void execute() throws Exception {
        FragmentManager fragmentManager = getFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.password_main_container, pwdInput);
        fragmentTransaction.commit();
    }

    @Override
    public boolean onKeyDown(KeyInfo keyInfo) {
        return pwdInput.onKeyDown(keyInfo);
    }

    public void setOnPwdListener(PwdInputFragment.OnPwdListener onPwdListener) {
        pwdInput.setOnPwdListener(onPwdListener);
    }

    @Override
    public boolean useNetwork() {
        return true;
    }
}
